package bn;
import java.util.Vector;

import main.Main;
import env.City;


public class ChemReportedNode {
	public City city;
	public double p; // TODO figure this out
	public Vector<TerroristNode> terroristSons;
	public ChemNode parent;
	public ChemReportedNode(City city, ChemNode parent) 
	{
		this.city = city;
		terroristSons = new Vector<TerroristNode>();
		this.parent = parent;
		p=Main.pChem*Main.pReveal;
	}

	public void addTerroristNode(TerroristNode newSon) 
	{
		terroristSons.add(newSon);
	}
	public double getP(boolean chem)
	{
		if(chem)
			return Main.pReveal;
		else
			return 0;
	}
	public String output()
	{
//		VERTEX 1: chem reported | chem
//		P(chem reported | chem) = 0.8
//			P(not chem reported | chem) = 0.2
//
//			P(chem reported | not chem) = 0
//			P(not chem reported | not chem) = 1
		String ans = new String();
		ans += "VERTEX " + city.getName() + ": chem reported | chem\n" + 
			"  p(chem reported | chem) = " + Main.pReveal + "\n" +
			"  p(not chem reported | chem) = " + (1 - Main.pReveal) + "\n" +
			"P(chem reported | not chem) = 0\n" +
			"P(not chem reported | not chem) = 1\n";
		return ans;
	}

	public double notReportedChem()
	{
		
		return 1-p;
	}

}
